// 最长严格递增子序列

var lengthOfLIS = function(nums) {
  const len = nums.length;
  if (len <= 1) return len;

  let dp = Array(len).fill(1);

  for (let i = 1; i < len; i++) {
    for (let j = 0; j < i; j++) {
      if (nums[i] > nums[j]) {
        dp[i] = Math.max(dp[i], dp[j] + 1);
      }
    }
  }

  return dp[len - 1];
}

const nums = [10,9,2,5,3,7,101,18];
console.log(lengthOfLIS(nums)); // 4